package com.plt.w2w;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;

import org.antlr.runtime.ANTLRStringStream;
import org.antlr.runtime.CharStream;
import org.antlr.runtime.CommonTokenStream;
import org.antlr.runtime.RecognitionException;
import org.antlr.runtime.TokenStream;

public class Test {

	/**
	 * @param args
	 * @throws RecognitionException 
	 */
	
	
	public static void main(String[] args) throws RecognitionException {
		
		CharStream charStream = new ANTLRStringStream("create wardrobe jasleen;\n" + 
				"{\n" + 
				"{\n" + 
				"item = shirt;\n" + 
				"}\n" + 
				"{\n" + 
				"item = top;\n" + 
				"color = blue;\n" + 
				"}\n" + 
				"{\n" + 
				"item = skirt;\n" + 
				"color = black;\n" + 
				"}\n" + 
				"}\n" + 
				"use wardrobe jasleen+afreen;\n" + 
				"void main()\n" + 
				"{\n" + 
				"date d;\n" + 
				"d = read();\n" + 
				"string p = \"22\";\n" + 
				"int w;\n" + 
				"w = 22;\n" + 
				"if(12==12) {\n" + 
				"	if(12==12){\n" + 
				"	date e = 11/30;}\n" + 
				"	else { date f = 12/04; }\n" + 
				"}\n" + 
				"print(\"hey\");\n" + 
				"print(e);\n" + 
				"generateOutfit(d);\n" + 
				"}"); 
		// TODO Auto-generated method stub
		GrammarLexer lexer = new GrammarLexer(charStream);
		TokenStream tokenStream = new CommonTokenStream(lexer);
		GrammarParser parser = new GrammarParser(tokenStream);
		parser.start();
//		String date = "02/28";
//		java.util.Date d = null;
//		SimpleDateFormat sdf = new SimpleDateFormat("MM/dd");
//		
//		try {
//			
//			 d = sdf.parse(date);
//		} catch (ParseException e) {
//			// TODO Auto-generated catch block
//			System.out.println("EXCEPTION!!!!!!!!!!!");
//			
//		}
//		
//		if(!sdf.format(d).equals(date)){
//			System.out.println("ERROR!!!!");
//		}
//		System.out.println(d);
//		Calendar cal = Calendar.getInstance();
//		cal.setTime( d );
//		cal.add( Calendar.DATE, 1 );
//		d = cal.getTime();
//		System.out.println(d);
		
//		
//		Set abc = symbolTable.keySet();
//		Iterator it = abc.iterator();
//		while(it.hasNext()){
//			
//			String variableName = (String) it.next();
//			String[] array = symbolTable.get(variableName);
//			String dataType = array[1];
//			System.out.println(dataType + " " + variableName);
//		}
		System.out.println("Done!!");
		
	}

}
